/**
 * Notes: 样品实体
 * Ver : CCMiniCloud Framework 2.0.1 ALL RIGHTS RESERVED BY cclinux0730 (wechat)
 * Date: 2024-03-10 19:20:00 
 */

const BaseProjectModel = require('../config/models_config').base_project_model;

class SampleModel extends BaseProjectModel {

}

// 集合名
SampleModel.CL = BaseProjectModel.C('oa_sample');

SampleModel.DB_STRUCTURE = {
    _pid: 'string|true',
    SAMPLE_ID: 'string|true',
    
    SAMPLE_CODE: 'string|true|comment=样品编码',
    SAMPLE_NAME: 'string|true|comment=样品名称',
    SAMPLE_PROJECT_ID: 'string|true|comment=关联项目ID',
    SAMPLE_TYPE: 'int|true|default=1|comment=类型：1=原型样品, 2=功能样品, 3=工程样品, 4=确认样品, 5=试产样品',
    SAMPLE_VERSION: 'string|false|comment=版本号',
    SAMPLE_STATUS: 'int|true|default=1|comment=状态：1=制作中, 2=测试中, 3=问题修复中, 4=已完成, 5=已送样, 6=客户测试中, 7=已签样, 8=已报废',
    SAMPLE_QUANTITY: 'int|true|default=1|comment=数量',
    
    SAMPLE_HARDWARE: 'object|true|default={}|comment=硬件信息',
    /*
    {
        schematicVersion: 'string', // 原理图版本
        pcbVersion: 'string', // PCB版本
        bomVersion: 'string' // BOM版本
    }
    */
    
    SAMPLE_SOFTWARE: 'object|true|default={}|comment=软件信息',
    /*
    {
        version: 'string', // 软件版本
        buildNumber: 'string' // 构建号
    }
    */
    
    SAMPLE_MAKE_START_TIME: 'int|false|comment=制作开始时间',
    SAMPLE_MAKE_END_TIME: 'int|false|comment=制作完成时间',
    SAMPLE_TEST_START_TIME: 'int|false|comment=测试开始时间',
    SAMPLE_TEST_END_TIME: 'int|false|comment=测试完成时间',
    SAMPLE_TO_CUSTOMER_TIME: 'int|false|comment=送样时间',
    SAMPLE_CUSTOMER_CONFIRM_TIME: 'int|false|comment=客户确认时间',
    
    SAMPLE_MAKE_USER_ID: 'string|false|comment=制作人ID',
    SAMPLE_TEST_USER_ID: 'string|false|comment=测试人ID',
    
    SAMPLE_LOCATION: 'string|false|comment=当前位置',
    SAMPLE_QR_CODE_URL: 'string|false|comment=二维码URL',
    SAMPLE_NOTES: 'string|false|comment=备注',
    SAMPLE_ATTACHMENTS: 'array|true|default=[]|comment=附件URL数组',
    
    SAMPLE_ADD_USER_ID: 'string|false|comment=创建人ID',
    SAMPLE_ADD_TIME: 'int|true',
    SAMPLE_EDIT_TIME: 'int|true',
    SAMPLE_ADD_IP: 'string|false',
    SAMPLE_EDIT_IP: 'string|false',
};

// 字段前缀
SampleModel.FIELD_PREFIX = "SAMPLE_";

/**
 * 类型：1=原型样品, 2=功能样品, 3=工程样品, 4=确认样品, 5=试产样品
 */
SampleModel.TYPE = {
    PROTOTYPE: 1,
    FUNCTIONAL: 2,
    ENGINEERING: 3,
    CONFIRMATION: 4,
    TRIAL: 5
};

SampleModel.TYPE_DESC = {
    PROTOTYPE: '原型样品',
    FUNCTIONAL: '功能样品',
    ENGINEERING: '工程样品',
    CONFIRMATION: '确认样品',
    TRIAL: '试产样品'
};

/**
 * 状态：1=制作中, 2=测试中, 3=问题修复中, 4=已完成, 5=已送样, 6=客户测试中, 7=已签样, 8=已报废
 */
SampleModel.STATUS = {
    MAKING: 1,
    TESTING: 2,
    FIXING: 3,
    COMPLETED: 4,
    SENT: 5,
    CUSTOMER_TESTING: 6,
    SIGNED: 7,
    SCRAPPED: 8
};

SampleModel.STATUS_DESC = {
    MAKING: '制作中',
    TESTING: '测试中',
    FIXING: '问题修复中',
    COMPLETED: '已完成',
    SENT: '已送样',
    CUSTOMER_TESTING: '客户测试中',
    SIGNED: '已签样',
    SCRAPPED: '已报废'
};

module.exports = SampleModel; 